const express = require("express");
var router = express.Router();
const miguMusic = require('migu-music-api').default;
router.get('/recommend/playlist', function(req, res, next) {
    console.log(req.query)
    miguMusic('recommend/playlist', { ...req.query,})
        .then((r) => {
            res.send({data:r,code:200})
        })
        .catch(r => res.send(r.data))
});
router.get('/playlist', function(req, res, next) {
    miguMusic('playlist', { ...req.query,})
        .then((r) => {
            res.send({data:r,code:200})
        })
        .catch(r => res.send(r.data))
});
router.get('/song', function(req, res, next) {
    console.log(req.query)
    miguMusic('song', { ...req.query,})
        .then((r) => {
            res.send({data:r,code:200})
        })
        .catch(r => res.send(r.data))
});
router.get('/search', function(req, res, next) {
    console.log(req.query)
    miguMusic('search', { ...req.query,})
        .then((r) => {
            res.send({data:r,code:200})
        })
        .catch(r => res.send(r.data))
});
router.get('/album/songs', function(req, res, next) {
    console.log(req.query)
    miguMusic('album/songs', { ...req.query,})
        .then((r) => {
            res.send({data:r,code:200})
        })
        .catch(r => res.send(r.data))
});
router.get('/singer/albums', function(req, res, next) {
    console.log(req.query)
    miguMusic('singer/albums', { ...req.query,})
        .then((r) => {
            res.send({data:r,code:200})
        })
        .catch(r => res.send(r.data))
});

router.get('/lyric', function(req, res, next) {
    console.log(req.query)
    miguMusic('lyric', { ...req.query,})
        .then((r) => {
            res.send({data:r,code:200})
        })
        .catch(r => res.send(r.data))
});
module.exports = router;